<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.asaga.tools.*, java.util.*, java.io.*, java.net.*, java.util.*"%>
<%--
     Author:  Jeremy Sanderlin 
     Date Created: 2007-02-01
     Last Modified: 2006-02-13
     Last Modified By: Jeremy Sanderlin
--%>
<%
    SystemClient_DBImpl scdb = (SystemClient_DBImpl)session.getAttribute("userProfile");
    SystemClient_DBImpl userProfile = scdb;
    if(scdb==null){
        response.sendRedirect("login.jsp?message=Please log in again.");
    }
    //SystemClient_DBImpl userProfile = scdb;
    GroupHandler gh = new GroupHandler();
    List GroupList = gh.getGroupList();
    Set myGroupSet = new TreeSet();
    myGroupSet = scdb.getGroupList();
%>     
<html>
    <%@ include file="header.jsp" %>
    <body>
        <div id="container">
            <%@ include file="topNav.jsp" %>
            <%@ include file="leftside.jsp" %>
            <%@ include file="rightside.jsp" %>
                <div id="content">
                    <b>List of groups <%=scdb.getEmail()%> belongs to:</b>
                    <% if(myGroupSet!=null){
                    Iterator itr0 = myGroupSet.iterator();
                    while(itr0.hasNext()){
                    Group_DBImpl group0 = (Group_DBImpl)itr0.next();
                    String groupName0 = group0.getGroupName();%>
                    <br>
                        <a href="AutismSiteMasterController?action=group?groupAction=forum?groupId=<%=group0.getGroupId()%>">
                            <%=groupName0%>
                        </a>
                    </br>
                    <%}
                    }%>
                    
                    <br><br>    
                    <b>List of all available groups:</b>
                    <%
                    if(GroupList!=null){
                    Iterator itr = GroupList.iterator();
                    while(itr.hasNext()){
                    Group_DBImpl group = (Group_DBImpl)itr.next(); 
                    String groupName = group.getGroupName();
                    //String groupName = (String)itr.next();
                    %>
                    <br> <a href="AutismSiteMasterController?action=group?groupAction=detail?groupId=<%=group.getGroupId()%>">
                            <%=groupName%>
                        </a>
                    </br>
                    <% }
                    }else{ %>
                    <%=gh.toString()%>
                    <%}%>
                    <br>
                    <hr>
                    <a href="AutismSiteMasterController?action=group?groupAction=add">
                        Create a Group
                    </a>
                    
                </div>
                <%//@ include file="footer.jsp" %>
            </div>
    </body>
</html>
